package com.csu.push;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.csu.util.HttpClient;

/**
 * IFID 刷卡推送
 */
public class HttpMessagePush {

    //养老院
    public static String url1="http://220.180.184.6:10017/OperateRest/DeviceSoltCardI/slotCard";

    //测试
   // public static String url2="http://192.168.31.24/OperateRest/DeviceSoltCardI/slotCard";

    public static void ifidPush(JSONObject jsonObject) throws Exception{

        HttpClient.postJson(url1,jsonObject);

    }

    public static void measurePush(JSONObject jsonObject) throws Exception{
        jsonObject.put("gatewayType","1");
        HttpClient.postJson(url1,jsonObject);

    }

    /**
     * 老人尿湿推送给护工
     * @throws Exception
     */
    public static void getHgId(String userId,String mark) throws Exception{
        String url="http://220.180.184.6:10020/show/behavior/getNusingByOldManId?oldId="+userId;
        JSONObject jsonObject= HttpClient.postJson(url,new JSONObject());
        JSONArray jsonArray=jsonObject.getJSONArray("data");
        for(int i=0;i<jsonArray.size();i++){
            JSONObject json= (JSONObject) jsonArray.get(i);
            AppPush.pushToSingle(json.getString("user_id"), "尿湿报警",mark,2);
        }
    }

   public static void main(String[] args) throws Exception{


    }
}
